﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Collections.ObjectModel;
using NotaManager;

namespace WpfClient.Models
{
    public class FileViewModel : ViewModelBase
    {
        private File _file;

        public File File
        {
            get { return _file; }
            set 
            {
                RaisePropertyChanged();
                _file = value; 
            }
        }


        public ObservableCollection<LineViewModel> Lines { get; set; }

        public string Title { get; set; }

        public FileViewModel(File file)
        {
            Title = file.Title;
            File = file;
            Lines = new ObservableCollection<LineViewModel>(file.Lines.Select((line, num) => { return new LineViewModel(line, num, file.Title, line.Rus.FirstOrDefault()); }));
        }
    }
}
